<?php
/**
 * Widget for displaying content of three categories (triple widget) on home page
 *
 * Used for both single and index/archive/search.
 *
 * @package WordPress
 * @subpackage lebanontimes
 * @since Lebanon Times 1.0
 */

include dirname(__FILE__)."/categoryMapping.php";
?>

<div class="multiLingualWidget widgetMargin">
    <div style="background-color: #FFF; width: 100%; height: 45px; clear: both;">
        <div class="tabActive">
            <span style='float: right'>
                <a href="<?php echo get_category_link( $categoryMapping['civil-society-arabic'][0] );?>">
                    <?php echo get_the_category_by_ID( $categoryMapping['civil-society-arabic'][0] );?>
                </a>
            </span>
            <span style='float: left'>
                <a href="<?php echo get_category_link( $categoryMapping['civil-society'][0] );?>">
                    <?php echo get_the_category_by_ID( $categoryMapping['civil-society'][0] );?>
                </a>
            </span>
        </div>
    </div>
    <div class="content">
        <div class="right">
            <ul>
                <?php $posts = get_posts("category={$categoryMapping['civil-society-arabic'][0]}&numberposts=0");
                    add_filter( 'the_title', 'max_title_length');
                    for($i=0;$i<$categoryMapping['civil-society-arabic'][1];$i++) {
                                $post = $posts[$i]; ?>
                    <li>
                        <a href="<?php the_permalink() ?>" target="_parent">
                            <div style="height: 80px; overflow-y: hidden;"><?php the_post_thumbnail( array(155,155) ); ?></div>
                            <?php the_title(); ?>
                        </a>
                        <div class="readMore"><a href="<?php the_permalink() ?>">إقرأ المزيد</a> <div class="arrow-left"></div></div>
                    </li>
                <?php 
                    } 
                    remove_filter( 'the_title', 'max_title_length');
                ?>
            </ul>
        </div>
        <div class="left">
            <ul>
                <?php $posts = get_posts("category={$categoryMapping['civil-society'][0]}&numberposts=0");
                    for($i=0;$i<$categoryMapping['civil-society'][1];$i++) {
                                $post = $posts[$i]; ?>
                    <li>
                        <a href="<?php the_permalink() ?>" target="_parent">
                            <div style="height: 80px; overflow-y: hidden;"><?php the_post_thumbnail( array(155,155) ); ?></div>
                            <?php the_title(); ?>
                        </a>
                        <div class="readMore"><a href="<?php the_permalink() ?>">more</a> <div class="arrow-right"></div></div>
                    </li>
                <?php } ?>
            </ul>
        </div>
    </div>
</div>